$envFilePath = "dev.env"
$envVariables = Get-Content $envFilePath | Where-Object { $_ -match '^\s*[^#\s][^=]*\s*=\s*.*$' }

foreach ($variable in $envVariables) {
    if ($variable -match '^\s*([^#\s][^=]*)\s*=\s*(.*)\s*$') {
        $name = $matches[1]
        $value = $matches[2]
        [System.Environment]::SetEnvironmentVariable($name, $value, [System.EnvironmentVariableTarget]::Machine)
    }
}